import time

from django.shortcuts import redirect
from django.utils.deprecation import MiddlewareMixin


class ConfirmPathMiddleware(MiddlewareMixin):

    def process_request(self, request):
        pass
        # allow_path = [
        #     '/', '/train/upload/', '/train/execute_predict/', '/train/download/',
        #     '/predict/upload/', '/predict/execute_predict/', '/predict/download/',
        #     '/train/execute_train/', '/predict/execute_train/', '/train/download/?choose=LightGBM',
        #     '/train/download/?choose=XgBoost', '/train/download/?choose=CatBoost',
        #     '/combination/upload/', '/combination/execute_combination/', '/combination/download/',
        #     '/logout/',
        # ]
        # path = request.path
        # if path not in allow_path:
        #     return redirect('home')

    def process_response(self, request, response):

        return response
